//处理url请求
var fs = require('fs')

let headers = {
    'Content-Type': 'text/html'
}
function home(res) {
    console.log('Request handler "home" was called.')

    var content = fs.readFileSync('./views/home.html')
    res.writeHead(200, {'Content-Type': 'text/html'})
    res.write(content)
    res.end()
}

// about.html关于页面
function about(res) {
    console.log('Request handler "about" was called.')

    var content = fs.readFileSync('./views/about.html')
    res.writeHead(200, headers)
    res.write(content)
    res.end()
}

exports.home = home
exports.about = about